package com.tougutips.modules.user.followers.task;

import com.tougutips.modules.user.followers.service.FollowersService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author:HuangYiF
 * @create: 2022-07-27 17:15
 * @Description:
 */
@Slf4j
public class FollowTask extends QuartzJobBean {
    @Autowired
    FollowersService followersService;

    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        log.info("FollowTask-------- {}", sdf.format(new Date()));
        followersService.saveRedis2DB();
    }
}
